<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        canvas {
            display: block;
            background-color: black;
        }

        body {
            margin: 0px;
        }
    </style>
</head>

<body>
    <canvas></canvas>
    <script>
        let canvas = document.querySelector('canvas')
        let ctx = canvas.getContext('2d')
        canvas.width = window.innerWidth;
        canvas.height = window.innerHeight;
        function randomColor() {
            let red = Math.floor(Math.random() * 256)
            let green = Math.floor(Math.random() * 256)
            let blue = Math.floor(Math.random() * 256)
            return 'rgba(' + red + ',' + green + ',' + blue + ','+'0.6)'
        }
        let textArr = ['x', 'y', 'z', 'o', 'a']

        function text(i) {
            this.x = i * 20
            this.y = 0
            this.speed = 15
            this.color = randomColor()
            this.text = textArr[Math.floor(Math.random() * textArr.length)]
        }
        let arr = []
        for (let i = 0; i < canvas.width /20; i++) {
            arr.push(new text(i))
        }


        setInterval(function () {
            ctx.fillStyle = 'rgba(0,0,0,0.05)'
            ctx.fillRect(0, 0, canvas.width, canvas.height)
            for (let i = 0; i < arr.length; i++) {
                if (arr[i].y >= canvas.height) {
                    arr[i].y = 0
                    arr[i].speed = Math.random() * 5+5
                }
                ctx.beginPath()
                ctx.font = '20px new romance'
                ctx.fillStyle = arr[i].color
                ctx.fillText(arr[i].text, arr[i].x, arr[i].y)               
                ctx.closePath()
                arr[i].y += arr[i].speed
            }
        }, 1000 / 90)

    </script>
</body>

</html>